<template>
    <div>
        <el-dialog title="编辑订单" :visible.sync="dialogVisible" width="500px">
            <el-form :model="editData" :rules="rules">
                <el-form-item label="订单编号">
                    <el-input autocomplete="off" v-model="editData.orderNo" disabled></el-input>
                </el-form-item>
                <el-form-item label="入住人">
                    <el-input autocomplete="off" v-model="editData.ruzhuren" disabled></el-input>
                </el-form-item>
                <el-form-item label="酒店名称">
                    <el-input v-model="editData.jdName" disabled></el-input>
                </el-form-item>
                <el-form-item label="房间名称">
                    <el-input v-model="editData.jdfxName" disabled></el-input>
                </el-form-item>
                <el-form-item label="间数">
                    <el-input v-model="editData.jianshu" disabled></el-input>
                </el-form-item>
                <el-form-item label="手机号" prop="userPhone">
                    <el-input type="number" v-model="editData.userPhone"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submit">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import { orderUpdateApi } from '@/api/msOrder'
export default {
    name: 'orderEdit',
    components: {},
    props: ['editData'],
    data() {
        return {
            dialogVisible:false,
            rules: {
              userPhone: [{
                    required: true,
                    message: '请输入手机号',
                    trigger: 'blur',
                }, {
                    max: 11,
                    message: '请输入正确的电话号码',
                    trigger: 'blur',
                }]
            }

        }
    },
    mounted() {
    },
    methods: {
        // 提交
        submit() {
            orderUpdateApi(this.editData).then(res => {
                if(res){
                    this.$message.success('编辑成功')
                    this.dialogVisible = false
                    this.$parent.getList();
                }else{
                    this.$message.error('操作失败')
                }
            }).catch(() => {
                this.dialogVisible = false
            })
        }
    }
}
</script>
